﻿using System.Collections.Generic;
using System.ComponentModel;
namespace TurnamentOrganizer
{
    public class Player
    {            
        public int Id { get; set; }
        public string Name { get; set; }
        public bool HasPaid { get; set; }
        public int Wins { get; set; }
        public int Losses { get; set; }
        public int ControlPoints { get; set; }
        public string HomeLocation { get; set; }
        public int Sos { get; set; }
        public List<Player> Opponents { get; set; }

        public Player()
        {
        }        

        public Player(string name)
        {
            Name = name;
            Sos = 0;
            Opponents = new List<Player>();
        }

        public override string ToString()
        {
            return Name;
        }

        public void CalculateSOS(List<Player> resultList)
        {
            for (int i = 0; i < resultList.Count; i++)
            {
                if (Opponents.Contains(resultList[i]))
                {
                    Sos += resultList.Count - i;
                }
            }
        }
    }
}
